using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;namespace Bll{	class CCommodityTypeManage	{		public static CCommodityType CreateCommodityType()       {                 return   new CCommodityType();       }	   	   public static CCommodityType Save(CCommodityType cdytype)	   {			try           {				int num = BLL.SqlHelper.ExecuteNonQuery(CConnection.getConnString(), "sp_AddCommodityType", cdytype.ID, cdytype.typeID, cdytype.objID, cdytype.type);             				if(0 == num)                   return null;
                return cdytype;           }           catch (Exception e)           {               return null;           }	   }	   	   public static bool Update(CCommodityType cdytype)	   {			try			{
                int num = BLL.SqlHelper.ExecuteNonQuery(CConnection.getConnString(), "sp_SaveCommodityType", cdytype.ID, cdytype.typeID, cdytype.objID, cdytype.type);				if (0 == num)                   return false;				return true;			}			catch (Exception e)			{               return false;			}	   }	   	   public static bool Delete(CCommodityType cdytype)	   {			try			{				int num = BLL.SqlHelper.ExecuteNonQuery(CConnection.getConnString(), "sp_RemoveCommodityType", cdytype.ID);				if (0 == num)                   return false;				return true;			}			catch (Exception e)			{               return false;			}	   }	   	   static CCommodityType GetCommodityType(String ID)	   {
           SqlDataReader reader = BLL.SqlHelper.ExecuteReader(CConnection.getConnString(), "sp_GetCommodityType", ID);			try           {                                             if (reader.Read())               { 					CCommodityType cdytype = new CCommodityType();					cdytype.typeID = reader["typeID"].ToString();					cdytype.objID = reader["objID"].ToString();					//cdytype.type = reader["type"].ToString();												return cdytype;               }			   reader.Close();               return null;           }           catch (Exception e)           {               return null;           }
            finally
            {
                reader.Close();
            }	   }	}}